﻿using System;

namespace 部分类
{
    //关键词：partial
    internal class Program
    {
        private static void Main(string[] args)
        {
            Person person = new Person("张三", "18");
            person.Print();
        }
    }

    public partial class Person
    {
        private string _name;

        public void Print()
        {
            Console.WriteLine($"姓名:{_name},年龄:{_age}");
        }
    }

    public partial class Person
    {
        private string _age;

        public Person(string name, string age)
        {
            _name = name; //这里也能访问到另一部分的东西
            _age = age;
        }
    }
}